home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 2170 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1013 b 

  1. Path: bunsen.HRZ.Uni-Marburg.DE!reeh
  2. From: reeh@bunsen.HRZ.Uni-Marburg.DE (Achim Reeh)
  3. Newsgroups: comp.unix.osf.osf1,comp.lang.c
  4. Subject: Re: printf-problem
  5. Followup-To: comp.unix.osf.osf1,comp.lang.c
  6. Date: 19 Jan 1996 17:11:31 GMT
  7. Organization: Department of Physics, University of Marburg, Germany
  8. Distribution: world
  9. Message-ID: <4dojc3$g2j@surz03fi.HRZ.Uni-Marburg.DE>
  10. References: <4dj4g6$t9f@sunsystem5.informatik.tu-muenchen.de>
  11. Reply-To: Achim.Reeh@mailer.uni-marburg.de
  12. NNTP-Posting-Host: bunsen.hrz.uni-marburg.de
  13. X-Newsreader: TIN [version 1.2 PL2]
  14.  
  15. Henrik Wist (wist@lam.mw.tu-muenchen.de) wrote:
  16. : Problem:
  17. : long int zahl;   /* which is e.g. 10000500001 */
  18. : printf("%d\n",zahl);      /* gives 1410565409, which is definitly wrong */
  19.  
  20. Solution:
  21.   printf("%ld\n",zahl);      /* gives 10000500001 */
  22.           ^^^
  23. %ld is the format specifier for long int output. long ints are 64 bit 
  24. under DEC Unix and DEC C. ints (format %d) have only 32 bit.
  25.  
  26. Achim
  27. --
  28. Achim Reeh, Achim.Reeh@mailer.uni-marburg.de
  29.